<?php


/*
* Copyright (c) 2008-2016 vip.com, All Rights Reserved.
*
* Powered by com.vip.osp.osp-idlc-2.5.11.
*
*/

namespace com\vip\svip\osp\service;

class SvipActRightsInfoForMapi {
	
	static $_TSPEC;
	public $rights_code = null;
	public $button_type = null;
	public $logo_url = null;
	public $rights_name = null;
	public $user_center_pic = null;
	
	public function __construct($vals=null){
		
		if (!isset(self::$_TSPEC)){
			
			self::$_TSPEC = array(
			1 => array(
			'var' => 'rights_code'
			),
			2 => array(
			'var' => 'button_type'
			),
			3 => array(
			'var' => 'logo_url'
			),
			4 => array(
			'var' => 'rights_name'
			),
			5 => array(
			'var' => 'user_center_pic'
			),
			
			);
			
		}
		
		if (is_array($vals)){
			
			
			if (isset($vals['rights_code'])){
				
				$this->rights_code = $vals['rights_code'];
			}
			
			
			if (isset($vals['button_type'])){
				
				$this->button_type = $vals['button_type'];
			}
			
			
			if (isset($vals['logo_url'])){
				
				$this->logo_url = $vals['logo_url'];
			}
			
			
			if (isset($vals['rights_name'])){
				
				$this->rights_name = $vals['rights_name'];
			}
			
			
			if (isset($vals['user_center_pic'])){
				
				$this->user_center_pic = $vals['user_center_pic'];
			}
			
			
		}
		
	}
	
	
	public function getName(){
		
		return 'SvipActRightsInfoForMapi';
	}
	
	public function read($input){
		
		$input->readStructBegin();
		while(true){
			
			$schemeField = $input->readFieldBegin();
			if ($schemeField == null) break;
			$needSkip = true;
			
			
			if ("rights_code" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->rights_code);
				
			}
			
			
			
			
			if ("button_type" == $schemeField){
				
				$needSkip = false;
				$input->readI32($this->button_type); 
				
			}
			
			
			
			
			if ("logo_url" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->logo_url);
				
			}
			
			
			
			
			if ("rights_name" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->rights_name);
				
			}
			
			
			
			
			if ("user_center_pic" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->user_center_pic);
				
			}
			
			
			
			if($needSkip){
				
				\Osp\Protocol\ProtocolUtil::skip($input);
			}
			
			$input->readFieldEnd();
		}
		
		$input->readStructEnd();
		
		
		
	}
	
	public function write($output){
		
		$xfer = 0;
		$xfer += $output->writeStructBegin();
		
		if($this->rights_code !== null) {
			
			$xfer += $output->writeFieldBegin('rights_code');
			$xfer += $output->writeString($this->rights_code);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldBegin('button_type');
		$xfer += $output->writeI32($this->button_type);
		
		$xfer += $output->writeFieldEnd();
		
		if($this->logo_url !== null) {
			
			$xfer += $output->writeFieldBegin('logo_url');
			$xfer += $output->writeString($this->logo_url);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->rights_name !== null) {
			
			$xfer += $output->writeFieldBegin('rights_name');
			$xfer += $output->writeString($this->rights_name);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->user_center_pic !== null) {
			
			$xfer += $output->writeFieldBegin('user_center_pic');
			$xfer += $output->writeString($this->user_center_pic);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldStop();
		$xfer += $output->writeStructEnd();
		return $xfer;
	}
	
}

?>